import java.awt.Point;
import java.util.Random;

import javax.swing.ImageIcon;
import javax.swing.JLabel;

/**
 *
 * @author Bora SAYINER
 * @since Dec 28, 2014 1:29:03 PM
 * @version 1.0
 */
public class Horse extends JLabel {

	private final Random random;

	private String nickName;

	public Horse(String name) {
		this.nickName = name;
		this.random = new Random();
		setIcon(new ImageIcon("horse.jpg"));
	}

	public String getNickName() {
		return nickName;
	}

	public void run() {
		int range = random.nextInt(20);
		Point point = getLocation();
		point.x += range;
		setLocation(point);
	}
}
